package com.yangjiayu.controller;

import com.yangjiayu.grace.result.GraceJSONResult;
import com.yangjiayu.pojo.bo.InterviewerBO;
import com.yangjiayu.service.InterviewerService;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;

/**
 * @Classname InterviewController
 * @Description TODO
 * @Date 2025/6/18 22:16
 * @Created by YangJiaYu
 */
@RestController
@RequestMapping("interviewer")
public class InterviewController {

    @Resource
    private InterviewerService interviewerService;

    /**
     * 创建或者更新数字人面试官的信息
     * @param interviewerBO
     * @return
     */
    @PostMapping("/createOrUpdate")
    public GraceJSONResult createOrUpdateInterview(@Valid @RequestBody InterviewerBO interviewerBO) {
        interviewerService.createOrUpdateInterviewer(interviewerBO);
        return GraceJSONResult.ok();
    }

    /**
     * 查询所有的面试官信息
     * @return
     */
    @GetMapping("/list")
    public GraceJSONResult queryAll(){
        return GraceJSONResult.ok(interviewerService.queryAll());
    }

    /**
     * 删除面试官信息
     * @param interviewerId
     * @return
     */
    @DeleteMapping("/delete")
    public GraceJSONResult deleteById(@RequestParam String interviewerId){
        interviewerService.delete(interviewerId);
        return GraceJSONResult.ok();
    }

}
